<script setup lang="ts">
import { useAppStoreHook } from "@/store";
const useAppStore = useAppStoreHook();

import { Search } from "@element-plus/icons-vue";
interface Props {}
const props = withDefaults(defineProps<Props>(), {});
const searchParamas = ref("");
const search_inputText = computed(() => useAppStore.search_inputText);
watch(searchParamas, (val) => {
  useAppStore.edit_search_inputText(val);
});
watch(search_inputText, (val) => {
  if (!val) {
    searchParamas.value = "";
  }
});
</script>

<template>
  <div class="layoutHeader">
    <user />
    <div class="right">
      <el-input
        v-model="searchParamas"
        style="width: 240px"
        placeholder="搜索全部文件"
        :prefix-icon="Search"
      />
      <TransmissionList />
    </div>
  </div>
</template>

<style lang="scss" scoped>
.layoutHeader {
  padding: px2rem(16px);
  border-bottom: 1px solid var(--el-border-color);
  display: flex;
  align-items: center;
  .right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
  }
}
</style>
